//
//  VOHMusicTableViewCell.m
//  VoiceOfHeart
//
//  Created by 吉龙 on 16/8/22.
//  Copyright © 2016年 吉龙. All rights reserved.
//

#import "VOHMusicTableViewCell.h"
#import <SDWebImage/UIImageView+WebCache.h>

@interface VOHMusicTableViewCell()
@property(nonatomic, strong)UIImageView *photoImage;
@property(nonatomic, strong)UILabel *title;
@property(nonatomic, strong)UILabel *contain;
@property(nonatomic, strong)UILabel *playNumber;
@end

@implementation VOHMusicTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUpView];
    }
    return self;
}

-(void)setUpView{
    self.photoImage = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 80, 90)];
    [self.contentView addSubview:self.photoImage];
    
    self.title = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.photoImage.frame) + 5, 5, 200, 30)];
    self.title.text = @"小清新";
    self.title.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.title];
    self.contain = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.title.frame), CGRectGetMaxY(self.title.frame) + 5, 200, 30)];
    self.contain.textColor = [UIColor lightGrayColor];
    self.contain.text = @"小清新";
    self.contain.font = [UIFont systemFontOfSize:14];
    
    [self.contentView addSubview:self.contain];
    
    self.playNumber = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.title.frame), CGRectGetMaxY(self.contain.frame) + 5, 200, 30)];
    
    self.playNumber.text = @"播放：20000";
    self.playNumber.textColor = [UIColor lightGrayColor];
    self.playNumber.font = [UIFont systemFontOfSize:14];
    
    self.contain.textColor = [UIColor lightGrayColor];

    
    [self.contentView addSubview:self.playNumber];
    
    
}

-(void)setModel:(VOHMusicDetailModel *)model{
    _model = model;
    [self.photoImage sd_setImageWithURL:[NSURL URLWithString:model.albumCoverUrl290]];
    self.title.text = model.title;
    self.contain.text = model.intro;
    NSString *str = [NSString stringWithFormat:@"播放量:%ld",model.playsCounts];
    self.playNumber.text = str;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
